<template>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item @click.native="goto('index')">首页</el-breadcrumb-item>
      <template  v-for="(item, key) in breadList" :index=key>
        <el-breadcrumb-item @click.native="goto(item.routeName,key)">{{item.text}}</el-breadcrumb-item>
      </template>
    </el-breadcrumb>
</template>

<script>
export default {
  name: 'breadcrumb',
  props: {
      breadList: {
      type: Array,
      required: true
    }
  },
  created(){
    //console.log(this.breadList)
  },
  methods: {
    goto(routeName,key) {
      if(key == this.breadList.length-1){
        return
      }
      this.$router.push({ name: routeName })
    }
  }
}
</script>

<style lang="stylus" scoped>

</style>
